package com.bgs.controller;

import com.bgs.pojo.Punch;
import com.bgs.pojo.PunchWay;
import com.bgs.service.PunchService;
import com.bgs.tool.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/punch")
public class PunchController {
    @Autowired
    private PunchService punchService;


    // 查询打卡时间
    @GetMapping("/select")
    public R selectall(){
        return punchService.selectall();
    }
    //添加打卡信息
    @PostMapping("/add")
    public R insert(Punch punch){
        return punchService.insert(punch);
    }
    //查询出勤天数
    @GetMapping("/getDays")
    public R getDays(){
        return punchService.getDays();
    }
    //查询迟到次数
    @GetMapping("/getLate")
    public R getLate(){
        return punchService.getLate();
    }
    //查询早退次数
    @GetMapping("/getEarly")
    public R getEarly(){
        return punchService.getEarly();
    }
    //查询所选日期打卡时间
    @GetMapping("/getSelectTime")
    public R getSelectTime(String ptime) {
        return punchService.getSelectTime(ptime);
    }

    //以下是web端方法
    //查询打卡地址
    @GetMapping("/pwSelect")
    public R pwSelect(){
        return punchService.pwSelect();
    }
    //删除打卡地址
    @GetMapping("/pwdelect")
    public R pwdelect(Integer pwid){
        return punchService.pwdelect(pwid);
    }
    //修改打卡地址
    @PostMapping("/pwupdate")
    public R pwupdate(@RequestBody PunchWay punchWay){
        return punchService.pwupdate(punchWay);
    }
    //添加打卡地址
    @PostMapping("/pwadd")
    public R pwadd(@RequestBody PunchWay punchWay){
        return punchService.pwadd(punchWay);
    }


}
